package com.cm.study.other.design.patterns.responsibility;

import java.util.List;

public class Chains {
    private List<Chain> chains;
    private int index;
    public Chains(List<Chain> chains){
        this.chains = chains;
    }
    public void doChain(){
        if (chains.size()==index){
            return ;
        }
        Chain chain = chains.get(index);
        index++;
        chain.f(this);
    }
}
